#ifndef _LINUX_GHASH_H_
#define _LINUX_GHASH_H_
#include <string.h>

#ifndef __USE_ISOC99
#define inline
#endif

#define create_hashtable(hsize) \
         hash_create(lh_strhash, equal_str, hsize)

unsigned int lh_strhash(char *src);
int equal_str(char *k1, char *k2);

struct _hashentry_t;
struct _hashtable_t;
typedef struct _hashtable_t   hashtable_t;


hashtable_t *hash_create(unsigned int (*keyfunc)(char *),
                       int (*comparefunc)(char *,char *),
                       int size);
void hash_free(hashtable_t *tab);
void hash_insert(char *key, void *data, hashtable_t *tab);
void hash_remove(char *key, hashtable_t *tab);
void * hash_value(char *key, hashtable_t *tab);
void hash_for_each_do(hashtable_t *tab, int (cb)(char *, void *));
int hash_count(hashtable_t *tab);

#endif
